<?php
class Quick_Search extends MY_Controller
{
	function __construct()
	{
		parent::__construct();

		$this->load->model('quick_search_model');
		$this->load->model('search_model');
		$this->load->model('country_model');
		$this->load->model('city_model');
		$this->validation->set_fields($this->search_model->fields);
		$this->validation->set_fields($this->quick_search_model->fields);
	}


	function index()
	{
		if (count($_POST))
		{
			$rules = array_keys($this->quick_search_model->rules);
			$this->validation->set_rules($this->quick_search_model->getRules($rules));
			if ($this->validation->run() === TRUE)
			{
				$this->data['rooms_list'] = $this->quick_search_model->roomsList();
			}
		}
		else
		{
			redirect(base_url());
		}

		//$this->view = 'search/index';
		$this->renderLayout();
	}

}
?>